<!DOCTYPE html>
<html class="bg-white">
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>修改文件表</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" th:href="@{/layui/css/layui.css}">
</head>

<body>
<form id="sysFileForm" lay-filter="sysFileForm" class="layui-form model-form">
    <input name="id" type="hidden"/>
        <div class="layui-form-item">
            <label class="layui-form-label">创建时间</label>
            <div class="layui-input-block">
                <input name="creatDaet" id="creatDaet" placeholder="请输入创建时间" type="text" class="layui-input"
                       lay-verify="required" required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">文件名</label>
            <div class="layui-input-block">
                <input name="fileName" id="fileName" placeholder="请输入文件名" type="text" class="layui-input"
                       lay-verify="required" required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">文件路径</label>
            <div class="layui-input-block">
                <input name="filePath" id="filePath" placeholder="请输入文件路径" type="text" class="layui-input"
                       lay-verify="required" required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <div class="layui-input-block">
                <input name="fileCode" id="fileCode" placeholder="请输入" type="text" class="layui-input"
                       lay-verify="required" required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">文件大小</label>
            <div class="layui-input-block">
                <input name="fileSize" id="fileSize" placeholder="请输入文件大小" type="text" class="layui-input"
                       lay-verify="required" required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">文件描述</label>
            <div class="layui-input-block">
                <input name="fileDesc" id="fileDesc" placeholder="请输入文件描述" type="text" class="layui-input"
                       lay-verify="required" required/>
            </div>
        </div>

    <div class="layui-form-item text-right">
        <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
        <button class="layui-btn" lay-filter="formSubmit" lay-submit>保存</button>
    </div>
</form>

<script type="text/javascript" th:src="@{/layui/layui.all.js}"></script>
<script type="text/javascript" th:src="@{/js/jquery-3.2.1.min.js}"></script>
<script th:inline="javascript">
    layui.use(['layer', 'form'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;

        var url = 'update';
        // 回显数据
        var sss = ${sysFile};
        console.log(sss)
        var sysFile = [[sysFile]];
        if (sysFile) {
            form.val('sysFileForm', sysFile);
        }

        // 表单提交事件
        form.on('submit(formSubmit)', function (data) {
            layer.load(2);
            $.post(url, data.field, function (data) {
                layer.closeAll('loading');
                if (data.code == 200) {
                    top.layer.msg(data.msg, {icon: 1});
                    // 关闭当前iframe弹出层
                    parent.layer.close(parent.layer.getFrameIndex(window.name));
                } else {
                    top.layer.msg(data.msg, {icon: 2});
                }
            });
            return false;
        });

    });
</script>

</body>
</html>